<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include  file="/WEB-INF/include/header.jsp"%>
  
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">
  
    <div class="panel panel-default x-panel x-panel-layout">
    
      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/user">用户管理</a></li>
          <li class="active">用户管理</li>
        </ol>
      </div>
    
      <div class="panel-body">
      
        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>
      
        <div class="col-xs-10 x-panel-layout-right">
          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>授权用户&nbsp;-&nbsp;用户列表</span></h2>
            </div>
          </div>
          
          
          <div class="x-toolbar-wrapper top-margin-20 clearfix">
            <div class="btn-group pull-right">
              <%-- <a href="${ctx.host}/users/exist" data-target="#user-mobile" data-toggle="modal" title="录入档案" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                <i class="glyphicon glyphicon-plus"></i>&nbsp;&nbsp;录入档案
              </a> --%>
              <c:if test="${!currentPrincipal.siteServer}">
                <a href="${ctx.host}/users/search${not empty queryString ? '?'.concat(queryString) : ''}" data-target="#" data-toggle="modal" title="过滤查询" class="btn btn-default x-btn btn-shadow btn-shadow-default">
                  <i class="glyphicon glyphicon-search"></i>&nbsp;&nbsp;过滤查询
                </a>
              </c:if>
            </div>
          </div>
          
          <c:if test="${!currentPrincipal.siteServer}">
            <table class="table table-striped table-hover x-table bottom-margin-20">
              <thead>
                <tr>
                  <th>姓名-性别</th>
                  <th>身高</th>
                  <th>体重</th>
                  <th>年龄</th>
                  <th>手机/邮箱</th>
                  <th>国-省-市-区</th>
                  <th>是否为学员</th>
                  <th>是否录入档案</th>
                  
                  <th class="text-center">操作</th>
                </tr>
              </thead>
              <tbody>
                <c:forEach var="users" items="${users}">
                  <tr>
                    <td>${users.name}-${users.userFit.gender.description}</td>
                    <td>${users.userFit.height}</td>
                    <td>${users.userFit.weight}</td>
                    <td>${users.userFit.age}</td>
                    <td>${users.mobile}</td>
                    <td>${users.profile.country}-${users.profile.province}-${users.profile.region}-${users.profile.district}</td>
                    <td>${users.student ? '是' : '否'}</td>
                    <td>${empty users.inputTime ? '否' : '是'}</td>
                    <td class="text-center">
                      <a href="${ctx.host}/users/${users.id}" title="详情">详情</a>&nbsp;&nbsp;
                      <c:if test="${not empty users.unionid}"><a href="${ctx.host}/users/${users.id}/unbind" data-target="#unbind" data-toggle="modal" title="小程序解绑">小程序解绑</a></c:if>
                      <c:if test="${empty users.name and !users.student}"><a href="${ctx.host}/users/${users.id}/disable" data-target="#disable" data-toggle="modal" title="删除用户">删除用户</a></c:if>
                    </td>
                  </tr>
                </c:forEach>
              </tbody>
            </table>
            
            <div class="form-horizontal clearfix">
              
              <c:choose>
                <c:when test="${refer == 'search'}">
                  <jsp:include page="/WEB-INF/include/page.jsp">
                    <jsp:param name="url" value="users/search" />
                    <jsp:param name="queryString" value="${queryString}" />
                  </jsp:include>
                </c:when>
                <c:otherwise>
                  <jsp:include page="/WEB-INF/include/page.jsp">
                    <jsp:param name="url" value="users" />
                    <jsp:param name="queryString" value="${queryString}" />
                  </jsp:include>
                </c:otherwise>
              </c:choose>
              
            </div>
          </c:if>
          
        </div>
      </div>
    </div>
  </div>
  
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/user/user-list.js">
    <script type="text/javascript">
      require(['page/user/user-list'], function(page) {
        page.init()
      })
    </script>
  </d:resource>
  
</body>
</html>